#ifndef IMOVINGSPHERE_H_
#define IMOVINGSPHERE_H_
#define DEBUG_
#define DEBUG2_
#include "CollisionManager.h"
#include "math/Vector3.h"
/*
*	___ IMOVINGSPHERE Header___
*
*
 
***************************************************************/

class IMovingSphere
{
	private:
		CollisionManager* 	_cm;
		Vector3 			estimateMove;
		bool 				_detectCollision;

		///////////////////////////////////////////////////////////////
		//// COLLISION COMPUTING METHODS
		//
			void CheckHuls( map<int,CollisionHul*>* huls );
			inline bool isInHul( CollisionHul* hul );
			void CheckPlanesCollision( int id, CollisionHul* hul );
			inline float distanceToPlane( const TrianglePlane* plane, const Vector3& p );
			inline float scalar( TrianglePlane* plane );
			inline bool GetIntersectionWithTriangle( const TrianglePlane* plane, const Vector3& rayPos,  const float& scal, Vector3& intersect   );
			inline bool planeLineIntersect( const Vector3& rayOrigin, const float& planeDistance, const Vector3& rayDir,const Vector3& planeNormal, const float& scal, Vector3& intersect);
			void CheckAndHandleEdge(const Vector3& origin, const Vector3& dir, const EdgeInfo& edge);
			void HandleCollision( const Vector3& normal, const Vector3& intersect, const Vector3& rayPos );
		//
		//// COLLISION COMPUTING METHODS
		///////////////////////////////////////////////////////////////
		
	
	protected:
		IMovingSphere( CollisionManager* cm );

	public:
		virtual Vector3 getPos() = 0;
		virtual Vector3 getDir() = 0;
		virtual float getRadius() = 0;
		
		void setCollisionDetection( bool detect );
		bool isCollisionDetection(  ) const;

		// bring die ganze kollisionsberechnung fuer den einen schritt zum laufen
		Vector3 GetMovement();
};

/***************************************************************/
#endif
